package com.guyu.common.core.enums;

import com.guyu.common.core.enums.able.IEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 用户类型
 * 针对多套 用户体系
 *
 * @author tanyp
 */
@Getter
@AllArgsConstructor
public enum LoginTypeEnum implements IEnum<LoginTypeEnum> {

    A(1, "admin", "管理员"),
    B(2, "tenant", "B端用户"),
    C(3, "client", "C端用户");
    //
    private Integer code;
    private String type;
    private String desc;

    public static LoginTypeEnum getUserType(String type) {
        for (LoginTypeEnum value : values()) {
            if (Objects.equals(value.getType(), type)) {
                return value;
            }
        }
        return null;
    }

    @Override
    public LoginTypeEnum getDefault() {
        return null;
    }
}
